Skip to content

test(ai-edition): share one base document in the addZoom invariant - #441

Merged
EtienneLescot merged 1 commit into
mainfrom
fix/addzoom-invariant-flake
Aug 21, 2026
Merged

test(ai-edition): share one base document in the addZoom invariant#441
EtienneLescot merged 1 commit into
mainfrom
fix/addzoom-invariant-flake

Conversation

@EtienneLescot

@EtienneLescot EtienneLescot commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

main has a flaky test. It just failed CI on an unrelated PR (#440, which touches only workbench/) with a one-digit diff:

"createdAt":"…T15:37:58.275Z"   vs   "createdAt":"…T15:37:58.276Z"

addZoom answers for the focus it was given > reports; it does not place calls fixtureDocument() twice, and createEmptyDocument stamps createdAt/updatedAt from the wall clock. So the two runs it compares start from two different documents, and withoutIds normalises zoom ids but not timestamps. The assertion holds only while both calls land in the same millisecond — a coin flip on a loaded runner.

Handing both runs the same document is also the invariant the test means to state: one zoom, written by a runtime that can read telemetry and one that cannot, must come out identical. Comparing the outputs of two different inputs was never that claim. executeAgentTool returns a new document rather than mutating its argument, and the shared-base pattern is already used elsewhere in this file.

Arrived with #431; not specific to anything in flight.

Related issue

Refs #431

Type of change

  • Bug fix
  • Feature
  • Enhancement
  • Documentation
  • Refactor / maintenance
  • Performance
  • Security

Release impact

  • No release note needed

Desktop impact

  • Not platform-specific

Testing

  • npx vitest --run electron/ai-edition/agent-tools.test.ts — 82 passed, run 8 times consecutively, green every time.
  • npx tsc -p tsconfig.test.json --noEmit — clean.
  • npx biome check — clean.

The flake is timing-dependent, so a green run does not prove much on its own; the argument is the removed dependency on two wall-clock reads landing in the same millisecond, not the run count.

Summary by CodeRabbit

  • Tests
    • Improved test reliability for zoom-related telemetry checks.
    • Ensured comparisons use consistent fixture data and are not affected by timestamp differences.

`createEmptyDocument` stamps `createdAt`/`updatedAt` from the wall clock, and
this test called `fixtureDocument()` twice — so the two runs it compares started
from two different documents, and the assertion held only while both calls
landed in the same millisecond. On a loaded CI runner that is a coin flip; it
just failed a PR that touches none of this code, with a one-digit diff:

    "createdAt":"…T15:37:58.275Z"   vs   "createdAt":"…T15:37:58.276Z"

Handing both runs the SAME document is also the invariant the test means to
state: one zoom, written by a runtime that can read telemetry and one that
cannot, must come out identical. Comparing outputs of two different inputs was
never that claim. The pattern is already used elsewhere in this file.
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 57d290b0-e110-48ff-8478-859809bb6c6d

📥 Commits

Reviewing files that changed from the base of the PR and between 1cc63df and b8962c5.

📒 Files selected for processing (1)
  • electron/ai-edition/agent-tools.test.ts

Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The addZoom telemetry consistency test now runs telemetry-aware and blind executions against the same base document. This removes timestamp differences caused by separate fixture creation from the document-equality assertion.

Changes

Telemetry consistency validation

Layer / File(s) Summary
Shared fixture comparison
electron/ai-edition/agent-tools.test.ts
The test reuses one base document for both addZoom executions before comparing their results.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to b8962

This localized test-only change makes the invariant deterministic by comparing executions against the same base document; no actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the test change to share one base document in the addZoom invariant.
Description check ✅ Passed The description includes the required summary, issue reference, change type, release impact, platform impact, and detailed testing information.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/addzoom-invariant-flake

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@EtienneLescot
EtienneLescot merged commit 6d66700 into main Aug 21, 2026
18 checks passed
@EtienneLescot
EtienneLescot deleted the fix/addzoom-invariant-flake branch August 21, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant